package com.hex.ds.hdtp.core.app.data.transfer.handler.impl;

import com.hex.ds.hdtp.core.app.data.transfer.handler.IDataTransferHandlerFileService;
import com.hex.ds.hdtp.core.app.data.transfer.handler.IDataTransferHandlerFlinkService;
import com.hex.ds.hdtp.core.app.data.transfer.handler.IDataTransferHandlerJdbcService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import java.util.Map;

@Slf4j
@Service
@RequiredArgsConstructor(onConstructor_ = {@Lazy, @Autowired})
public class DataTransferSelectHandlerContext {

    private final Map<String, IDataTransferHandlerFlinkService> DataTransferFlinkServiceMap;

    private final Map<String, IDataTransferHandlerFileService> DataTransferFileServiceMap;

    private final Map<String, IDataTransferHandlerJdbcService> DataTransferJdbcServiceMap;

    public IDataTransferHandlerFlinkService getDataInfoFlinkService(String type) {
        return DataTransferFlinkServiceMap.getOrDefault(type, DataTransferFlinkServiceMap.get("FLINK_COMMON"));

    }

    public IDataTransferHandlerFileService getDataInfoFileService(String type) {
        return DataTransferFileServiceMap.get(type);
    }

    public IDataTransferHandlerJdbcService getDataInfoJdbcService(String type) {
        return DataTransferJdbcServiceMap.get(type);
    }

}
